Release 10.1A: OpenEdge Development:
Progress 4GL Reference
= Assignment operator
Assigns the value of an expression to a database field or variable.
Data movement
![]()
Syntax
fieldThe name of a database field or variable to which you want to assign the value of the expression. If the field is an array, and you do not name a particular element, Progress stores
expressionin each element of the array. If you name a particular element, Progress storesexpressionin that element.The left side of an assignment can also be an attribute or Progress keyword (such as ENTRY, FRAME-VALUE, SUBSTRING, or OVERLAY).
expressionAn expression with a data type that is consistent with the data type of the
field. Iffieldis integer andexpressionis decimal, then Progress rounds the value of the expression before assigning it. Iffieldis decimal andexpressionis decimal, then Progress rounds the value of the expression to the number of decimal places defined for the field in the Dictionary or defined or implied for a variable.NO-ERRORSuppresses any errors that occur as a result of the operation. After the assignment completes, you can check the ERROR-STATUS system handle for information about any errors that might have occurred.
If you do not specify this option and an error occurs, the assignment is canceled and any changes to field values within the assignment are undone. If the assignment occurs within a transaction, any changes to variables, work table fields, and temporary table fields are also undone, unless you define the variable or field with the NO-UNDO option.
ExampleThis procedure resets all the monthly quota values to 0 in all salesrep records. If you want to set values for individual array elements, you can do so by making an explicit assignment using the assignment statement and a specific array reference, such as month-quota[1] or month-quota[i].
Notes
- If you assign a value to a database field, any ASSIGN trigger associated with that field executes at the end of the assignment statement (after any index changes are made). If the trigger returns ERROR, the assignment fails and the database changes are undone.
- You can embed an assignment in a SET or UPDATE statement.
- For multiple assignments, use the ASSIGN statement. This is more efficient than multiple assignment statements.
- You can assign DATE, DATETIME, and DATETIME-TZ data. When the data type expression on the left side of the assignment statement contains more information than the data type expression on the right side provides (for example,
datetime-tz = datewhere a DATETIME-TZ value contains more information than a DATE value), the time value defaults to midnight and the time zone value defaults to the session's time zone. When the data type expression on the left side of the assignment statement contains less information than the data type expression on the right side provides (for example,date = datetime-tzwhere a DATE value contains less information than a DATETIME-TZ value), Progress converts the DATETIME-TZ value to the local date and time of the session, then drops the time and time zone.Note: When assigning BLOB or CLOB fields, the field must appear by itself on either the right-hand or the left-hand side of the assignment.- You can assign large object data from one BLOB or MEMPTR to another, and from one CLOB, LONGCHAR, or CHARACTER to another. You cannot assign large object data between BLOBs and CLOBs or MEMPTRs and LONGCHARs. You can accomplish this, indirectly, by using the COPY-LOB statement. For more information, see the COPY-LOB statement reference entry.
Table 8 lists the default character conversions Progress performs when assigning CLOB, LONGCHAR, and CHARACTER data between a source and target object. References to CLOBCP and CLOBDB represent CLOB data in either the CLOB’s defined code page or the database's defined code page, respectively. References to the "fixed code page" represent the code page of a target LONGCHAR variable set using the FIX-CODEPAGE function.
- When you assign the Unknown value (
?) to a BLOB or CLOB field, Progress deletes any associated object data.See also
ASSIGN statement, Data types, COPY-LOB statement, FIX-CODEPAGE function
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |